#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
#include <cstdlib>
#include "drift.h"

char symbol[] = 
"xs 1 1 -4 1 1 ++++ " // space in the end is important!
"v 1 1 -4 1 1 ++++ "
"a 0 0 -2 1 1 --++ "
"b 0 1 -3 1 1 -+++ "
"c 0 1 -2 0 1 -+-+ "
"d 1 0 -3 1 1 +-++ "
"e 1 1 -3 0 1 ++-+ "
"f 0 1 -3 1 1 -p++ "
"g 0 1 -3 1 1 -+p+ "
"h 1 1 -4 1 1 +p++ "
"i 1 1 -4 1 1 ++p+ "
"j 1 1 -3 1 0 +p+- "
"k 1 1 -3 1 0 +++- "
"l 1 1 -3 1 0 ++p- ";


char map[] =
".....abbbbbbbbc....." // no space!
".....dxxxxxxxxe....."
".....dxxxxxxxxe....."
".....dxxxxxxxxe....."
"fbbbbxxxxxxxxxxbbbbg"
"hxxxxxxxxxxxxxxxxxxi"
"hxxxxxxxxxxxxxxxxxxi"
"hxxxxxxxxxxxxxxxxxxi"
"hxxxxxxxxxxxxxxxxxxi"
"hxxxxxxvvvvvvxxxxxxi"
"hxxxxxxvvssvvxxxxxxi"
"hxxxxxxvvssvvxxxxxxi"
"hxxxxxxvvvvvvxxxxxxi"
"hxxxxxxxxxxxxxxxxxxi"
"hxxxxxxxxxxxxxxxxxxi"
"hxxxxxxxxxxxxxxxxxxi"
"hxxxxxxxxxxxxxxxxxxi"
"hxxxxxxxxxxxxxxxxxxi"
"hxxxxxxxxxxxxxxxxxxi"
"jkkkkkkkkkkkkkkkkkkl";

char value[]="* 0.5 s 88";
char diff[]="* 6 s 0.3 v 0.3";
char source[]="v 1.5";

int nx=20;
int ny=20;

int main() {
  try {
    DriftSolver M(nx,ny,symbol,map);
    
    /*
    DriftSolver M(nx,ny);
    M.SetSymbolMap(symbol);
    M.SetMap(map);
    */
    M.SetValue(value);
    M.SetDFactor(diff);
    M.SetSFactor(source);
    
    
    M.Step(0);
    M.Dump(std::cerr);
    M.DumpVector(std::cout);
    M.DumpFactor(std::cout);
  } catch (const char* st) {
    std::cerr << st << std::endl;
  }
  return 0;
}

